import React from "react";
import {isDom} from "../utils/isDom";
import {set} from './reactivity'

Object.assign(React, {
    $$set: (target: any, property: string, event: any) => {
        let value;
        if (event == null) {
            value = event;
        } else if (isDom(event.target)) {
            /*const nativeEvent = event.nativeEvent || event
            /!*修复问题：中文输入法的情况下，每次按键都会增加一个空格*!/
            if (nativeEvent.inputType === 'insertCompositionText') {return}*/
            value = event.target.value;
        } else {
            value = event;
        }
        if (target[property] != value) {
            if (!(property in target)) {
                set(target, property, value)
            } else {
                target[property] = value
            }
        }
    }
})